function loginUser()
{
	var givenUsername = $("#usernameBox").val();
	$.ajax({
		  url: "http://localhost:2323/TripleGameService.svc/UserId/"+givenUsername,
		  dataType:"json",
		  success: function(data){
		    sessionStorage.setItem('userID', data);
		    $("#loginSection").hide();
			SampleFunc();
		  }
		});
}

function SampleFunc() {
    $.ajax({
        url: "http://localhost:2323/TripleGameService.svc/GetMatrix/" + 1,
        dataType: "json",
        success: function (data) {
            var givenArray = new Array();
            for (var i = 0; i < data.length; i++) {
                alert(data[i]);
                givenArray.push(data[i]);
            }
            CreateGameTable(givenArray);
        }
    });
}

function CreateGameTable(array) {

	boardSection = document.getElementById('gameBoard');
   
	for (var i in array) {
		if (i % 10 == 0) {
			var newLine = document.createElement('div');
			newLine.setAttribute("class", "newLine");

			boardSection.appendChild(newLine);
		}

		if (array[i] == 0) {
			var emptyCell = document.createElement("div");
			emptyCell.setAttribute("class", "emptyCell");
			//emptyCell.innerText = "fafa";
			boardSection.appendChild(emptyCell);

		}
		else if (array[i] == 1) {
			var emptyCell = document.createElement("div");
			emptyCell.setAttribute("class", "normalCellA");
			//emptyCell.innerText = "fafa";
			boardSection.appendChild(emptyCell);

		}
		else if (array[i] == 2) {
			var emptyCell = document.createElement("div");
			emptyCell.setAttribute("class", "normalCellB");
			boardSection.appendChild(emptyCell);
		}

	}

}